﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace QianBuo.Lottery.Web.Models.Login
{
    public class LoginModel
    {
        /// <summary>
        /// 用户名
        /// </summary>
        [Required(ErrorMessage="请输入用户名")]
        //[RegularExpression(@"^\w{4,15}$", ErrorMessage = "格式不正确")]
        [DisplayName("用户名:")]
        public string LoginName
        { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        [Required(ErrorMessage = "请输入密码")]
        //[RegularExpression(@"^\w{6,15}$", ErrorMessage = "格式不正确")]
        [DisplayName("密码:")]
        [DataType(DataType.Password)]
        public string LoginPwd
        { get; set; }
        /// <summary>
        /// 验证码
        /// </summary>
        
        [DisplayName("验证码")]
        public string CheckCode
        { get; set; }

        /// <summary>
        /// 元角模式
        /// </summary>
        public double Ratio
        { get; set; }

        /// <summary>
        /// 奖金模式
        /// </summary>
        public short WinModel
        { get; set; }

        public ModelNameValue<double, string> Ratios { get; set; }
        public ModelNameValue<int, string> WinModels { get; set; }

        /// <summary>
        /// 验证码的显示和隐藏
        /// </summary>
        public bool Show { get; set; }
        public int Num { get; set; }
    }

    [Comparison("ConfirmLoginPwd", "NewPwd", ComparerOperator.Equal,ErrorMessage="*")]
    public class FindPwdModel
    {
        /// <summary>
        /// 用户名
        /// </summary>
        [Required(ErrorMessage="*")]
        [DisplayName("用户名")]
        public string LoginName { get; set; }

        /// <summary>
        /// 安全邮箱
        /// </summary>
        [Required(ErrorMessage="*")]
        [DisplayName("安全邮箱")]
        public string Email { get; set; }

        /// <summary>
        /// 密钥
        /// </summary>
        [Required(ErrorMessage="*")]
        [DisplayName("密钥")]
        public string InputKey { get; set; }

        /// <summary>
        /// 新密码
        /// </summary>
        [Required(ErrorMessage="*")]
        [DisplayName("新密码")]
        [DataType(DataType.Password)]
        [RegularExpression("^.{6,12}$",ErrorMessage="格式正确")]
        public string NewPwd { get; set; }

        /// <summary>
        /// 确认密码
        /// </summary>
        [Required(ErrorMessage="*")]
        [DisplayName("新密码")]
        [DataType(DataType.Password)]
        [CustomComparison(ComparerDataType.String,"NewPwd",ComparerOperator.Equal,ErrorMessage="两次密码输入不一致")]
        public string ConfirmLoginPwd { get; set; }

        /// <summary>
        /// 验证码
        /// </summary>
        [Required(ErrorMessage="*")]
        [DisplayName("验证码")]
        public string RegestCode { get; set; }
    }
}